<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" href="../css/bootstrap.min.css">
    <script src="../../configure.js"></script>
</head>
<body style="background-color: #F5F6F7">
<div class="container" style="background-color:white;margin-top: 20px">
<form id="form" style="margin:10px 0px 10px">
    <span style="font-size:larger;color: black">添加快递员</span>
    <hr style="border: black 1px solid">
    <div class="form-group">
        <label for="courierNum">快递员编号</label>
        <input type="text" class="form-control" name="courierNum" id="courierNum" placeholder="请输入快递员ID">
    </div>
    <div class="form-group">
        <label for="courierPhone">电话号</label>
        <input type="text" class="form-control" name="courierPhone" id="courierPhone" placeholder="请输入电话号">
    </div>
    <div class="form-group">
        <label for="courierPassword">密码</label>
        <input type="password" class="form-control" name="courierPassword" id="courierPassword">
    </div>
    <div class="form-group">
        <label for="courierName">姓名</label>
        <input type="text" class="form-control" name="courierName" id="courierName" placeholder="请输入姓名">
    </div>
    <div data-toggle="distpicker" class="form-group">
        <label>地址 :</label>
        <select name="courierProvince"></select>
        <select name="courierCity"></select>
        <select name="courierArea"></select>
    </div>
    <div class="form-group">
        <label>性别 :</label>
        <label class="radio-inline">
            <input type="radio" name="sex" value="1">男
        </label>
        <label class="radio-inline">
            <input type="radio" name="sex" value="0">女
        </label>
    </div>
    <div class="form-group">
        <label for="IdCard">身份证号</label>
        <input type="text" class="form-control" name="IdCard" id="IdCard" placeholder="请输入身份证号">
    </div>
    <div class="form-group">
        <label for="siteId">所属站点ID</label>
        <input type="text" class="form-control" name="siteId" id="siteId" placeholder="请输入所属站点ID">
    </div>
    <button id="bt" type="submit" class="btn btn-primary form-control ">添加</button>
</form>
</div>
<script src="../js/jquery-3.3.1.min.js"></script>
<script src="../js/bootstrap.min.js"></script>
<script src="../js/distpicker.data.js"></script>
<script src="../js/distpicker.js"></script>
<script src="../layer/layer.js"></script>
<script type="text/javascript">
    $(function(){
        $("#form").submit(function(){
            let courierNum = $("#courierNum").val();
            let courierPhone = $("#courierPhone").val();
            let courierPassword = $("#courierPassword").val();
            let courierName = $("#courierName").val();
            let IdCard = $("#IdCard").val();
            let siteId = $("#siteId").val();

            $.post(url+"/admin/addCourier",{
                courierNum:courierNum,
                courierPhone:courierPhone,
                courierPassword:courierPassword,
                courierName:courierName,
                IdCard:IdCard,
                siteId:siteId
            },function(data){
                //layer.msg(data.data.message);
                console.log(data)
                if(data.code == 0){
                    //录入成功
                    layer.msg("添加成功");
                    $("input").val("");
                    // $("input:eq(1)").val("顺丰速运");
                }else{
                    layer.msg("添加失败");
                    //录入失败
                }
            });
            return false
        });
    });
</script>
</body>
</html>